package com.yinhe.system.service.impl;

import com.yinhe.common.annotation.DataScope;
import com.yinhe.common.utils.DateUtils;
import com.yinhe.system.domain.YhContractSecond;
import com.yinhe.system.mapper.YhContractSecondMapper;
import com.yinhe.system.service.IYhContractSecondService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 合同Service业务层处理
 * 
 * @author yinhe
 * @date 2022-09-26
 */
@Service
public class YhContractSecondServiceImpl implements IYhContractSecondService 
{
    @Autowired
    private YhContractSecondMapper yhContractSecondMapper;

    /**
     * 查询合同
     * 
     * @param id 合同主键
     * @return 合同
     */
    @Override
    public YhContractSecond selectYhContractSecondById(Long id)
    {
        return yhContractSecondMapper.selectYhContractSecondById(id);
    }

    /**
     * 查询合同列表
     * 
     * @param yhContractSecond 合同
     * @return 合同
     */
    @Override
    @DataScope(deptAlias = "yh_contract_second", userAlias = "yh_contract_second")
    public List<YhContractSecond> selectYhContractSecondList(YhContractSecond yhContractSecond)
    {
        return yhContractSecondMapper.selectYhContractSecondList(yhContractSecond);
    }

    /**
     * 新增合同
     * 
     * @param yhContractSecond 合同
     * @return 结果
     */
    @Override
    public int insertYhContractSecond(YhContractSecond yhContractSecond)
    {
        yhContractSecond.setCreateTime(DateUtils.getNowDate());
        return yhContractSecondMapper.insertYhContractSecond(yhContractSecond);
    }

    /**
     * 修改合同
     * 
     * @param yhContractSecond 合同
     * @return 结果
     */
    @Override
    public int updateYhContractSecond(YhContractSecond yhContractSecond)
    {
        yhContractSecond.setUpdateTime(DateUtils.getNowDate());
        return yhContractSecondMapper.updateYhContractSecond(yhContractSecond);
    }

    /**
     * 批量删除合同
     * 
     * @param ids 需要删除的合同主键
     * @return 结果
     */
    @Override
    public int deleteYhContractSecondByIds(Long[] ids)
    {
        return yhContractSecondMapper.deleteYhContractSecondByIds(ids);
    }

    /**
     * 删除合同信息
     * 
     * @param id 合同主键
     * @return 结果
     */
    @Override
    public int deleteYhContractSecondById(Long id)
    {
        return yhContractSecondMapper.deleteYhContractSecondById(id);
    }
}
